package com.pinkpig.excel.metadata;

import java.util.ArrayList;
import java.util.List;

/**
 * 表元数据信息
 */
public class TableMetaData extends MetaData {
    private String tableName;
    private String remarks;
    private String category;
    private List<ColumnMetaData> columns = new ArrayList<>();
    private List<IndexMetaData> indexes = new ArrayList<>();
    private PrimaryKeyMetaData primaryKey;

    public void addColumn(ColumnMetaData columnMetaData){
        columns.add(columnMetaData);
    }

    public void addIndex(IndexMetaData indexMetaData){
        indexes.add(indexMetaData);
    }

    public ColumnMetaData getColumn(String columnName){
        return columns.stream().filter(t-> t.getColumnName().equals(columnName)).findFirst().get();
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public List<ColumnMetaData> getColumns() {
        return columns;
    }

    public void setColumns(List<ColumnMetaData> columns) {
        this.columns = columns;
    }

    public List<IndexMetaData> getIndexes() {
        return indexes;
    }

    public void setIndexes(List<IndexMetaData> indexes) {
        this.indexes = indexes;
    }

    public PrimaryKeyMetaData getPrimaryKey() {
        return primaryKey;
    }

    public void setPrimaryKey(PrimaryKeyMetaData primaryKey) {
        this.primaryKey = primaryKey;
    }
}
